package com.dubbo.client;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dubbo.api.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author WJG
 * @date 2021/3/9 14:20
 * @desc
 */
@EnableDiscoveryClient
@SpringBootApplication
public class ClientApplication {
    public static void main(String[] args) {
        SpringApplication.run(ClientApplication.class, args);
    }

    @Slf4j
    @RestController
    static class TestController {

        @Reference
        TestService helloService;

        @GetMapping("/test")
        public String test() {
            return helloService.test("hello dubbo");
        }
    }
}
